import java.util.concurrent.CountDownLatch;

/**
 * Created by walker on 2017/6/5.
 */
public class MD5Thread extends Thread{
    private String file;
    CountDownLatch countDownLatch;

    public MD5Thread(CountDownLatch countDownLatch) {
        this.countDownLatch = countDownLatch;
    }

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+ "   线程就绪");
        while (true) {
            file = FileUtil.takeFile();
            if (file == null)
                break;
            System.out.println("线程_" + Thread.currentThread().getName() + "_正在计算_" + file + "的MD5值");
            FileUtil.computeFileMD5AndSaveResult(file);
        }
        System.out.println(Thread.currentThread().getName()+ "   线程结束");
        FileUtil.countDown();//计数器减一
    }
}
